****Perceptions of Obama race
gen borace=C4_ZP2
recode borace -6 -5=.
label var borace "R Marked 'Black' as Obama's Race"


****Demographics
gen white=C4_PPETHM
recode white 1=1 2/5=0
label var white "Respondent identifies as Non-Hispanic White"
tab white

gen female=C4_PPGENDER
recode female 1=0 2=1
label var female "Respondent Gender"
tab female

gen age=C4_PPAGE
label var age "Respondent age"
tab age

gen educ2=C4_PPEDUCAT
recode educ2 1=0 2=.33 3=.67 4=1
label var educ2 "Education Levels (0-1)"
tab educ2

gen income2=(C4_PPINCIMP - 1)/18
label var income2 "Respondent Income (0-1)"
tab income2


tab C4_PPSTATEN
gen south_id=C4_PPSTATEN 
replace south=0 if south==1
replace south=1 if south==54
replace south=1 if south==56
replace south=1 if south==57
replace south=1 if south==58
replace south=1 if south==59
replace south=1 if south==62
replace south=1 if south==63
replace south=1 if south==64
replace south=1 if south==71
replace south=1 if south==72
replace south=1 if south==74
replace south=0 if south>1
label var south "Eleven States of Old Confederacy"
tab south


gen ownhome=C4_PPRENT
recode ownhome 1=1 2/3=0
label var ownhome "Respondent of R's Family Owns Home"
tab ownhome

*****Political Information
gen roberts3=C4_ZH1
recode roberts3 1=1 2/4=0 -7=0 -6 -5=.
gen cameron3=C4_ZH2
recode cameron3 1=1 2/4=0 -7=0 -6 -5=.
gen boehner3=C4_ZH3
recode boehner3 1=1 2/4=0 -7=0 -6 -5=.
gen fedspend3=C4_ZH4
recode fedspend3 1=1 2/4=0 -7=0 -6 -5=.
gen info3=(roberts3 + cameron3 + boehner3 + fedspend3)/4
label var info3 "Information Scale with ONLY 'No Answer' & incorrect Responses Folded into '0'"

*****Racial Resentment Scale
gen favors=C4_ZA1
recode favors -7 -6 -5=. 1=4 2=3 3=2 4=1 5=0

gen slavery=C4_ZA2
recode slavery -7 -6 -5=. 1=0 2=1 3=2 4=3 5=4

gen deserve=C4_ZA3
recode deserve -7 -6 -5=. 1=0 2=1 3=2 4=3 5=4

gen harder=C4_ZA4
recode harder -7 -6 -5=. 1=4 2=3 3=2 4=1 5=0

gen sracism=(favors + slavery + deserve + harder)/16
label var sracism "Racial Resentment Scale"
tab sracism

*****Political Variables
gen pid7=C4_partyid7
recode pid7 1=0 2=.17 3=.33 4=.5 5=.67 6=.83 7=1
label var pid7 "7-Point PID Scale"
tab pid7

gen pid3=C4_partyid3
recode pid3 1=0 2=.5 3=1
label var pid3 "3-Category Party ID (Dem=1)"
tab pid3

gen ideo=C4_P1
recode ideo -7 -6 -5=. 1=6 2=5 3=4 4=3 5=2 6=1 7=0
gen ideo7=(ideo/6)
label var ideo7 "Ideology 7-point scale (0-1)"
tab ideo7

gen ideo3=ideo
recode ideo3 0/2=0 3=.5 4/6=1
label var ideo3 "Ideology 3-point scale (0-1"
tab ideo3


*****Belief that Obama is a Muslim
gen muslim=C4_ZM16
recode muslim -7 -6 -5=. 1/3=0 4=1 5/7=0
label var muslim "Respondent Believes Obama is a Muslim"
tab muslim


******Analyses

logit muslim borace female age educ2 income2 south_id ownhome info3 sracism ideo7 if white==1 & pid3==0 [pweight=C4_weight]
logit muslim borace female age educ2 income2 south_id ownhome info3 sracism ideo7 if white==1 & pid3==1 [pweight=C4_weight]
logit muslim borace female age educ2 income2 south_id ownhome info3 sracism pid7 if white==1 & ideo3==0 [pweight=C4_weight]
logit muslim borace female age educ2 income2 south_id ownhome info3 sracism pid7 if white==1 & ideo3==1 [pweight=C4_weight]


margins, at(borace=(0(1)1)) atmeans


